Current Location: Home> Function Categories> srand

srand

Sow the random number generator seeds
Name:srand
Category:math
Programming Language:php
One-line Description:Sow the random number generator seeds.

Definition and usage

srand() function sows the random number generator seed.

Example

In this example, we will seed the random number generator:

 <?php
srand ( mktime ( ) ) ;
echo ( rand ( ) ) ;
?>

Try it yourself

grammar

 srand ( seed )
parameter describe
seed Optional. Use seed to sow the random number generator seeds.

illustrate

Starting from PHP version 4.2.0, the seed parameter becomes optional, and when this item is empty, it will be set to any time.

Similar Functions
  • Hyperbolic sine sinh

    sinh

    Hyperbolicsine
  • Antihyperbolic cosine acosh

    acosh

    Antihyperboliccosine
  • Generate a random integer rand

    rand

    Generatearandominteg
  • Returns the remainder of the floating point number of division fmod

    fmod

    Returnstheremaindero
  • Perform floating point division under IEEE 754 semantics fdiv

    fdiv

    Performfloatingpoint
  • Convert decimal to binary decbin

    decbin

    Convertdecimaltobina
  • Square root sqrt

    sqrt

    Squareroot
  • Cosine cos

    cos

    Cosine
Popular Articles